class Solution
{
public:
    bool checkSymmetricTree(TreeNode* root)
    {
        return root == NULL || recheck(root->left, root->right);
    }
private:
    bool recheck(TreeNode* L, TreeNode* R)
    {
        if (L == NULL && R == NULL)
            return true;
        if (L == NULL || R == NULL || L->val != R->val)
            return false;
        return recheck(L->left, R->right) && recheck(L->right, R->left);
    }
};